module Controle (
    input    [5:0]    op ,
    input    [5:0]    fn ,
    input    [4:0]    rt ,

    output   [2:0]    selwsource ,
    output   [1:0]    selregdest ,
    output            writereg ,
    output            writeov ,
    output            selimregb ,
    output            selsarega ,
    output            selalushift ,
    output   [2:0]    aluop ,
    output            unsig ,
    output   [1:0]    shiftop ,
    output            mshw ,
    output            lshw ,
    output   [2:0]    msm ,
    output   [2:0]    msl ,
    output            readmem ,
    output            writemem ,
    output   [1:0]    selbrjumpz ,
    output   [1:0]    seltipopc ,
    output   [2:0]    compop
    ) ;

    // Registrador auxiliar:
    reg [32:0] linha ;

    // Sinais de saida:
    assign selimregb = linha[32] ;
    assign selsarega = linha[31] ;
    assign selbrjumpz = linha[30:29] ;
    assign selregdest = linha[28:27] ;
    assign selwsource = linha[26:24] ;
    assign writereg = linha[23] ;
    assign writeov = linha[22] ;
    assign unsig = linha[21] ;
    assign shiftop = linha[20:19] ;
    assign aluop = linha[18:16] ;
    assign selalushift = linha[15] ;
    assign compop = linha[14:12] ;
    assign seltipopc = linha[11:10] ;
    assign readmem = linha[9] ;
    assign writemem = linha[8] ;
    assign mshw = linha[7] ;
    assign lshw = linha[6] ;
    assign msm = linha[5:3] ;
    assign msl = linha[2:0] ;

    // Atualizacao dos sinais de saida:
    always @( op or fn or rt ) begin
        if(op == 6'b000000 && fn == 6'b000000 ) begin linha = 33'b010001000111101111111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b000010 ) begin linha = 33'b010001000111001111111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b000011 ) begin linha = 33'b010001000111011111111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b000100 ) begin linha = 33'b000001000111101111111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b000110 ) begin linha = 33'b000001000111001111111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b000111 ) begin linha = 33'b000001000111011111111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b001000 ) begin linha = 33'b100111111011111111111010011111111 ; end
        if(op == 6'b000000 && fn == 6'b001001 ) begin linha = 33'b100101011111111111111010011111111 ; end
        if(op == 6'b000000 && fn == 6'b100000 ) begin linha = 33'b000001000100110100111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b100001 ) begin linha = 33'b000001000111110100111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b100010 ) begin linha = 33'b000001000100111100111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b100011 ) begin linha = 33'b000001000111111100111110011111111 ; end 
        if(op == 6'b000000 && fn == 6'b100100 ) begin linha = 33'b000001000111110000111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b100101 ) begin linha = 33'b000001000111110010111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b100110 ) begin linha = 33'b000001000111111010111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b100111 ) begin linha = 33'b000001000111111000111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b101010 ) begin linha = 33'b000001100110111100111110011111111 ; end
        if(op == 6'b000000 && fn == 6'b101011 ) begin linha = 33'b000001100111111100111110011111111 ; end
        if(op == 6'b000001 && rt == 5'b00000 ) begin linha = 33'b101011111010111111100000011111111 ; end
        if(op == 6'b000001 && rt == 5'b00001 ) begin linha = 33'b101011111010111111001000011111111 ; end
        if(op == 6'b000001 && rt == 5'b10000 ) begin linha = 33'b101010011110111111100000011111111 ; end
        if(op == 6'b000001 && rt == 5'b10001 ) begin linha = 33'b101010011110111111001000011111111 ; end
        if(op == 6'b000010 ) begin linha = 33'b110111111011111111111100011111111 ; end
        if(op == 6'b000011 ) begin linha = 33'b110110011111111111111100011111111 ; end
        if(op == 6'b000100 ) begin linha = 33'b101011111010111111000000011111111 ; end
        if(op == 6'b000101 ) begin linha = 33'b101011111010111111101000011111111 ; end
        if(op == 6'b000110 ) begin linha = 33'b101011111010111111010000011111111 ; end
        if(op == 6'b000111 ) begin linha = 33'b101011111010111111011000011111111 ; end
        if(op == 6'b001000 ) begin linha = 33'b100000000100110100111110011111111 ; end
        if(op == 6'b001001 ) begin linha = 33'b100000000111110100111110011111111 ; end
        if(op == 6'b001010 ) begin linha = 33'b100000100100111100111110011111111 ; end
        if(op == 6'b001011 ) begin linha = 33'b100000100111111100111110011111111 ; end
        if(op == 6'b001100 ) begin linha = 33'b100000000111110000111110011111111 ; end
        if(op == 6'b001101 ) begin linha = 33'b100000000111110010111110011111111 ; end
        if(op == 6'b001110 ) begin linha = 33'b100000000111111010111110011111111 ; end
        if(op == 6'b001111 ) begin linha = 33'b110000010111111111111110011111111 ; end
        if(op == 6'b010000 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b010001 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b010010 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b010011 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b010100 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b010101 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b010110 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b010111 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b011000 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b011001 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b011010 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b011011 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b011100 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b011101 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b011110 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b011111 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b100000 ) begin linha = 33'b100000001110110100111111011011011 ; end
        if(op == 6'b100001 ) begin linha = 33'b100000001110110100111111011011001 ; end
        if(op == 6'b100010 ) begin linha = 33'b100000001110110100111111010010000 ; end
        if(op == 6'b100011 ) begin linha = 33'b100000001110110100111111011001010 ; end
        if(op == 6'b100100 ) begin linha = 33'b100000001110110100111111011000100 ; end
        if(op == 6'b100101 ) begin linha = 33'b100000001110110100111111011000001 ; end
        if(op == 6'b100110 ) begin linha = 33'b100000001110110100111111001000001 ; end
        if(op == 6'b100111 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b101000 ) begin linha = 33'b100011111010110100111110111100011 ; end
        if(op == 6'b101001 ) begin linha = 33'b100011111010110100111110111010000 ; end
        if(op == 6'b101010 ) begin linha = 33'b100011111010110100111110101000001 ; end
        if(op == 6'b101011 ) begin linha = 33'b100011111010110100111110111001010 ; end
        if(op == 6'b101100 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b101101 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b101110 ) begin linha = 33'b100011111010110100111110110010000 ; end
        if(op == 6'b101111 ) begin linha = 33'b111111111010111111111110011111111 ; end
        if(op == 6'b110000 ) begin linha = 33'b100000001110110100111111011001010 ; end
        if(op == 6'b110001 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b110010 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b110100 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b110101 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b110110 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b110111 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b111000 ) begin linha = 33'b100000001110110100111110111001010 ; end
        if(op == 6'b111001 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b111010 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b111011 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b111100 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b111101 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b111110 ) begin linha = 33'b111111111011111111111110011111111 ; end
        if(op == 6'b111111 ) begin linha = 33'b111111111011111111111110011111111 ; end

    end

endmodule
    
/*

000000000000XXXXX01000100011X10XXX1XXXXX00XXXXXXXX ;
000000000010XXXXX01000100011X00XXX1XXXXX00XXXXXXXX ;
000000000011XXXXX01000100011X01XXX1XXXXX00XXXXXXXX ;
000000000100XXXXX00000100011X10XXX1XXXXX00XXXXXXXX ;
000000000110XXXXX00000100011X00XXX1XXXXX00XXXXXXXX ;
000000000111XXXXX00000100011X01XXX1XXXXX00XXXXXXXX ;
000000001000XXXXXX001XXXXX0XXXXXXXXXXX0100XXXXXXXX ;
000000001001XXXXXX0010101111XXXXXXXXXX0100XXXXXXXX ;
000000100000XXXXX000001000100XX0100XXXXX00XXXXXXXX ;
000000100001XXXXX000001000111XX0100XXXXX00XXXXXXXX ;
000000100010XXXXX000001000100XX1100XXXXX00XXXXXXXX ;
000000100011XXXXX000001000111XX1100XXXXX00XXXXXXXX ;
000000100100XXXXX00000100011XXX0000XXXXX00XXXXXXXX ;
000000100101XXXXX00000100011XXX0010XXXXX00XXXXXXXX ;
000000100110XXXXX00000100011XXX1010XXXXX00XXXXXXXX ;
000000100111XXXXX00000100011XXX1000XXXXX00XXXXXXXX ;
000000101010XXXXX000001100110XX1100XXXXX00XXXXXXXX ;
000000101011XXXXX000001100111XX1100XXXXX00XXXXXXXX ;
000001XXXXXX00000X010XXXXX0X0XXXXXX1000000XXXXXXXX ;
000001XXXXXX00001X010XXXXX0X0XXXXXX0010000XXXXXXXX ;
000001XXXXXX10000X01010011110XXXXXX1000000XXXXXXXX ;
000001XXXXXX10001X01010011110XXXXXX0010000XXXXXXXX ;
000010XXXXXXXXXXXXX01XXXXX0XXXXXXXXXXX1000XXXXXXXX ;
000011XXXXXXXXXXXXX011001111XXXXXXXXXX1000XXXXXXXX ;
000100XXXXXXXXXXXX010XXXXX0X0XXXXXX0000000XXXXXXXX ;
000101XXXXXXXXXXXX010XXXXX0X0XXXXXX1010000XXXXXXXX ;
000110XXXXXXXXXXXX010XXXXX0X0XXXXXX0100000XXXXXXXX ;
000111XXXXXXXXXXXX010XXXXX0X0XXXXXX0110000XXXXXXXX ;
001000XXXXXXXXXXX100000000100XX0100XXXXX00XXXXXXXX ;
001001XXXXXXXXXXX100000000111XX0100XXXXX00XXXXXXXX ;
001010XXXXXXXXXXX100000100100XX1100XXXXX00XXXXXXXX ;
001011XXXXXXXXXXX100000100111XX1100XXXXX00XXXXXXXX ;
001100XXXXXXXXXXX10000000011XXX0000XXXXX00XXXXXXXX ;
001101XXXXXXXXXXX10000000011XXX0010XXXXX00XXXXXXXX ;
001110XXXXXXXXXXX10000000011XXX1010XXXXX00XXXXXXXX ;
001111XXXXXXXXXXXXX000001011XXXXXXXXXXXX00XXXXXXXX ;
010000XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
010001XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
010010XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
010011XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
010100XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
010101XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
010110XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
010111XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
011000XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
011001XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
011010XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
011011XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
011100XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
011101XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
011110XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
011111XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
100000XXXXXXXXXXX100000001110XX0100XXXXX1011011011 ;
100001XXXXXXXXXXX100000001110XX0100XXXXX1011011001 ;
100010XXXXXXXXXXX100000001110XX0100XXXXX1010010000 ;
100011XXXXXXXXXXX100000001110XX0100XXXXX1011001010 ;
100100XXXXXXXXXXX100000001110XX0100XXXXX1011000100 ;
100101XXXXXXXXXXX100000001110XX0100XXXXX1011000001 ;
100110XXXXXXXXXXX100000001110XX0100XXXXX1001000001 ;
100111XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
101000XXXXXXXXXXX1000XXXXX0X0XX0100XXXXX0111100011 ;
101001XXXXXXXXXXX1000XXXXX0X0XX0100XXXXX0111010000 ;
101010XXXXXXXXXXX1000XXXXX0X0XX0100XXXXX0101000001 ;
101011XXXXXXXXXXX1000XXXXX0X0XX0100XXXXX0111001010 ;
101100XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
101101XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
101110XXXXXXXXXXX1000XXXXX0X0XX0100XXXXX0110010000 ;
101111XXXXXXXXXXXXXXXXXXXX0X0XXXXXXXXXXX00XXXXXXXX ;
110000XXXXXXXXXXX100000001110XX0100XXXXX1011001010 ;
110001XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
110010XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
110100XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
110101XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
110110XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
110111XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
111000XXXXXXXXXXX1000000011X0XX0100XXXXX0111001010 ;
111001XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
111010XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
111011XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
111100XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
111101XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
111110XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;
111111XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXX00XXXXXXXX ;

*/
